package com.rsk.dao.info.extend;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Component;


@Component
public class RskInfoTabExtend {
	
	public Map<String, Object> selectInfoTabByPage(String labelName){
		 // 拼接SQL语句
       StringBuilder sql = new StringBuilder("SELECT id,label_name,label_remarks FROM rsk_info_tab Where is_del = 0");
       StringBuilder countSql = new StringBuilder("SELECT count(id) FROM rsk_info_tab where is_del = 0 ");
       
       // 查询需要的参数，先存进Map
       StringBuilder paramSql = new StringBuilder();
       Map<String, Object> paramMap = new HashMap<String, Object>();
       if (labelName != null && !labelName.isEmpty()) {
    	   paramSql.append(" and label_name like :labelName");
    	   paramMap.put("labelName", "%" + labelName + "%");
       }
       
       //排序
       StringBuilder orderSql = new StringBuilder();
       orderSql = orderSql.append(" order by operator_time desc");
       
       Map<String, Object> returnMap = new HashMap<String, Object>();
       returnMap.put("sql", sql.append(paramSql).append(orderSql));
       returnMap.put("countSQL", countSql.append(paramSql));
       returnMap.put("paramMap", paramMap);
		return returnMap;
	}
}
 